package editAir.editContent
{
	import flash.display.MovieClip;
	import flash.display.Shape;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	
	public class ListBottomLineBox extends MovieClip
	{
		private var _tray_title:MovieClip;
		private var _mouseDown:Boolean=false;
		private var _lastMousePoint:Point=new Point;
		private var _lastObjectPosition:Point=new Point;
		
		public function ListBottomLineBox()
		{
			super();
			addPics();
			addEvents();
		}
		
		private function addEvents():void
		{
			this.addEventListener(MouseEvent.MOUSE_DOWN, titleMouseDown)
			ModelUiManege.stage.addEventListener(MouseEvent.MOUSE_MOVE, stageMouseMove)
			ModelUiManege.stage.addEventListener(MouseEvent.MOUSE_UP, stageMouseUp)

		}

		protected function stageMouseUp(event:MouseEvent):void
		{
			_mouseDown=false;
		}
		
		protected function stageMouseMove(event:MouseEvent):void
		{
			if (_mouseDown)
			{
				var toY:Number=_lastObjectPosition.y + ((ModelUiManege.stage.mouseY - _lastMousePoint.y));
				toY=toY<200?200:toY;
				this.y=toY;
				ModelList(Object(parent)).changeListSize(0,toY);
			}
		}
		
		protected function titleMouseDown(event:MouseEvent):void
		{
			_mouseDown=true;
			_lastObjectPosition.x=this.x
			_lastObjectPosition.y=this.y
			_lastMousePoint.x=ModelUiManege.stage.mouseX
			_lastMousePoint.y=ModelUiManege.stage.mouseY
		}
		private function addPics():void
		{
			var backPic:Shape=new Shape;
			addChild(backPic);
			backPic.graphics.beginFill(0xffffff, 1);
			backPic.graphics.drawRect(0, 0, 250, 1);
			backPic.graphics.beginFill(0xe4e4e4, 1);
			backPic.graphics.drawRect(0, 1, 250, 9);
			backPic.graphics.endFill();
			
	
		}
	}
}
